

import 'package:common_utils/common_utils.dart';

/**
 * 时间转换
 */
class TimeUtil{
  static String getDateStrByTimeStr(String dateTime,{String? format}){
    return DateUtil.formatDateStr('$dateTime',format: format??'yyyy-MM-dd');
  }
  static DateTime? getDateTimeByMs(int dateTimeMs,{String? format}){
    return DateUtil.getDateTimeByMs(dateTimeMs);
  }
  static int getDateMsByTimeStr(String dateTime,{String? format}){
    return DateUtil.getDateMsByTimeStr('$dateTime')??0;
  }
static DateTime? getTimeDate(String dateTime,{String? format}){
    return DateUtil.getDateTime('$dateTime');
  }

  static String getDateStrByByMs(int dateTime,{String? format}){
    return DateUtil.formatDateMs(dateTime,format: format??'yyyy-MM-dd');
  }
  static String getTimeStrByByDateTime(DateTime? dateTime,{String? format}){
    return DateUtil.formatDate(dateTime, format: format??'yyyy-MM-dd HH:mm:ss');
  }
  static int getMillisecondsSinceEpochTime({int?  day,int? hours,int? minutes,}){
    int millisecondsSinceEpochTime=(day??0)*24*60*60*1000+(hours??0)*60*60*1000+(minutes??0)*60*1000;
    return millisecondsSinceEpochTime;
  }
}